<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<link href="/static/css/bootstrap.min.css" rel="stylesheet" />
	<link href="/static/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="/static/css/font-awesome.min.css" />
	<!-- page specific plugin styles -->
	<!-- 下拉框-->
	<link rel="stylesheet" href="/static/css/chosen.css" />
	<!-- ace styles -->
	<link rel="stylesheet" href="/static/css/ace.min.css" />
	<link rel="stylesheet" href="/static/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="/static/css/ace-skins.min.css" />
	<script type="text/javascript" src="/static/js/jquery-1.7.2.js"></script>
	<link rel="stylesheet" href="/static/css/datepicker.css" /><!-- 日期框 -->
	<!--引入弹窗组件end-->
	<script type="text/javascript" src="/static/js/jquery.tips.js"></script>
	
	<!--引入弹窗组件start-->
	<script type="text/javascript" src="/admin/plugins/attention/zDialog/zDrag.js"></script>
	<script type="text/javascript" src="/admin/plugins/attention/zDialog/zDialog.js"></script>
		<!--/.fluid-container#main-container-->
	<!-- basic scripts -->
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="/static/js/bootstrap.min.js"></script>
		<script src="/static/js/ace-elements.min.js"></script>
		<script src="/static/js/ace.min.js"></script>
		<!-- 引入 -->

		<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
		<script type="text/javascript" src="/static/js/myjs/menusf.js"></script>

	<style type="text/css">
	.commitopacity{position:absolute; width:100%; height:100px; background:#7f7f7f; filter:alpha(opacity=50); -moz-opacity:0.8; -khtml-opacity: 0.5; opacity: 0.5; top:0px; z-index:99999;}


	.icon_leftkc{
		background-image: url('/static/img/icon_leftkc.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftkc{
		background-image: url('/static/img/icon_leftkc2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}
	.icon_leftkh{
		background-image: url('/static/img/icon_leftkh.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftkh{
		background-image: url('/static/img/icon_leftkh2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}
	.icon_leftorder{
		background-image: url('/static/img/icon_leftorder.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftorder{
		background-image: url('/static/img/icon_leftorder2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}
	.icon_leftdata{
		background-image: url('/static/img/icon_leftdata.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftdata{
		background-image: url('/static/img/icon_leftdata2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}
	.icon_leftrmb{
		background-image: url('/static/img/icon_leftrmb.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftrmb{
		background-image: url('/static/img/icon_leftrmb2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}
	.icon_leftsend{
		background-image: url('/static/img/icon_leftsend.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftsend{
		background-image: url('/static/img/icon_leftsend2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}

	.icon_leftuser{
		background-image: url('/static/img/icon_leftuser.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftuser{
		background-image: url('/static/img/icon_leftuser2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}

	.icon_leftindex{
		background-image: url('/static/img/icon_leftindex.png');
		background-size:100% 100%;
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	    width: 25px;
	    height: 25px;
	    margin: 5px;
	}
	.active .icon_leftindex{
		background-image: url('/static/img/icon_leftindex2.png');
		display: inline-block;
	    vertical-align: middle;
	    min-width: 30px;
	    text-align: center;
	    font-size: 18px;
	    font-weight: normal;
	     width: 25px;
	    height: 25px;
	    margin: 5px;
	    background-size:100% 100%;
	}

	</style>




</head>
<body>
<!-- 头部 -->
<div class="navbar navbar-inverse">
	<div class="navbar-inner">
		<div class="container-fluid">
			<a class="brand"><small><i class="icon-leaf"></i> 碳氢知识数据管理平台</small> </a>
	 		<ul class="nav ace-nav pull-right">
				<li class="light-blue user-profile">
					<a class="user-menu dropdown-toggle" href="javascript:;" data-toggle="dropdown">
						<img alt="FH" src="/static/img/avatars/user.jpg" class="nav-user-photo" />
						<span id="user_info"><small>Welcome</small> 管理员</span>
						<i class="icon-caret-down"></i>
					</a>
					<ul id="user_menu" class="pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
						<li class="divider"></li>
						<li><a onclick="exit();"><i class="icon-off"></i> 退出</a></li>
					</ul>
				</li>
			</ul> 
		</div>
	</div>
</div>
<!-- 左侧 -->		
<div id="websocket_button"></div>
<div class="container-fluid" id="main-container">
	<a href="#" id="menu-toggler"><span></span></a>
	<div id="sidebar" class="">
		<div id="sidebar-shortcuts">
			<div id="sidebar-shortcuts-large" >
				<button class="btn btn-small btn-danger" title="菜单管理" id="adminmenu" onclick="menu();"><i class="icon-folder-open"></i></button>
			</div>
			<div id="sidebar-shortcuts-mini">
				<span class="btn btn-success"></span>
				<span class="btn btn-info"></span>
				<span class="btn btn-warning"></span>
				<span class="btn btn-danger"></span>
			</div>
		</div>
		<ul class="nav nav-list">
			<li id="lm${menu.menuId }" th:each="menu : ${menuList}" th:if="${menu.menuUrl}=='#'">
				<a style="cursor:pointer;" class="dropdown-toggle"  >
					<i class="icon-desktop" th:if="${menu.menuIcon }== null"></i>
					<i th:attr="class=${menu.menuIcon }" th:if="${menu.menuIcon }!= null"></i>
					<span>[[${menu.menuName }]]</span>
					<b class="arrow icon-angle-down"></b>
				</a>
				<ul class="submenu">
					<li th:id="'z'+${menu1.menuId }"  th:each="menu1 : ${menuList}" th:if="${menu1.parentId}==${menu.menuId}" >
						<a style="cursor:pointer;" th:if="${menu1.menuUrl }!= null" target="mainFrame"  th:attr="onclick='siMenu(`z'+${menu1.menuId }+'`,`lm'+${menu.menuId }+'`,`'+${menu1.menuName }+'`,`'+${menu1.menuUrl }+'`)'"><i class="icon-double-angle-right"></i>[[${menu1.menuName }]]</a>
					</li>
				</ul>
			</li>
		</ul>
		<div id="sidebar-collapse"><i class="icon-double-angle-right icon-double-angle-left "></i></div>
	</div>
	<div id="main-content" class="clearfix">
		<div id="jzts" style="display:none; width:100%; position:fixed; z-index:99999999;">
			<div class="commitopacity" id="bkbgjz"></div>
			<div style="padding-left: 70%;padding-top: 1px;">
				<div style="float: left;margin-top: 3px;"><img src="/static/images/loadingi.gif" /> </div>
				<div style="margin-top: 5px;"><h4 class="lighter block red">&nbsp;加载中 ...</h4></div>
			</div>
		</div>
		<div>
			<iframe name="mainFrame" id="mainFrame" frameborder="0" src="/admin/tab" style="margin:0 auto;width:100%;height:100%;"></iframe>
		</div>
	</div>
</div>
<!--引入属于此页面的js 
<script type="text/javascript" src="/js/heads.js"></script>-->
<script type="text/javascript">
$(function() {
	if (typeof ($.cookie('menusf')) == "undefined") {
		$("#menusf").attr("checked", true);
		//$("#sidebar").attr("class", "menu-min");
	} else {
		$("#sidebar").attr("class", "");
	}
});
function exit(){
	$.post("/exit");
	window.location.href="/";
}
function cmainFrame(){
	var hmain = document.getElementById("mainFrame");
	var bheight = document.documentElement.clientHeight;
	hmain.style.width = '100%';
	hmain.style.height = (bheight  - 51) + 'px';
	var bkbgjz = document.getElementById("bkbgjz");
	bkbgjz.style.height = (bheight  - 41) + 'px';
	
}
cmainFrame();
window.onresize=function(){  
	cmainFrame();
};
jzts();
var locat = (window.location+'').split('/'); 
$(function(){if('main'== locat[3]){locat =  locat[0]+'//'+locat[2];}else{locat =  locat[0]+'//'+locat[2]+'/'+locat[3];};});


//菜单状态切换
var fmid = "fhindex";
var mid = "fhindex";
function siMenu(id,fid,MENU_NAME,MENU_URL){
	if(id != mid){
		$("#"+mid).removeClass();
		mid = id;
	}
	if(fid != fmid){
		$("#"+fmid).removeClass();
		fmid = fid;
	}
	$("#"+fid).attr("class","active open");
	$("#"+id).attr("class","active");
	top.mainFrame.tabAddHandler(id,MENU_NAME,MENU_URL);
	if(MENU_URL != "druid/index.html"){
		jzts();
	}
}

$(function(){
	//换肤
	$("#skin-colorpicker").ace_colorpicker().on("change",function(){
		var b=$(this).find("option:selected").data("class");
		hf(b);
		var url = locat+'/head/setSKIN.do?SKIN='+b+'&tm='+new Date().getTime();
		$.get(url,function(data){});
	
	});
});

var USER_ID;

var user = "FH";	//用于即时通讯（ 当前登录用户）

$(function(){
	$.ajax({
		type: "POST",
		url: '/admin/getUname?tm='+new Date().getTime(),
    	data: encodeURI(""),
		dataType:'json',
		//beforeSend: validateData,
		cache: false,
		success: function(data){
			 $("#user_info").html('<small>Welcome</small> '+data);
		}
	});
});

//在线管理
var websocket;
function online(){
	if (window.WebSocket) {
		websocket = new WebSocket(encodeURI('ws://'+oladress));
		
		websocket.onopen = function() {
			//连接成功
			websocket.send('[join]'+user);
		};
		websocket.onerror = function() {
			//连接失败
		};
		websocket.onclose = function() {
			//连接断开
		};
		//消息接收
		websocket.onmessage = function(message) {
			var message = JSON.parse(message.data);
			if (message.type == 'count') {
				userCount = message.msg;
			}else if(message.type == 'goOut'){
				$("body").html("");
				goOut("此用户在其它终端已经早于您登录,您暂时无法登录");
			}else if(message.type == 'thegoout'){
				$("body").html("");
				goOut("您被系统管理员强制下线");
			}else if(message.type == 'changeMenu'){
				window.location.href=locat+'/main/yes';
			}else if(message.type == 'userlist'){
				userlist = message.list;
			}
		};
	}
}

//在线总数
var userCount = 0;
function getUserCount(){
	websocket.send('[count]'+user);
	return userCount;
}
//用户列表
var userlist = "";
function getUserlist(){
	websocket.send('[getUserlist]'+user);
	return userlist;
}
//强制下线
function goOut(msg){
	alert(msg);
	window.location.href=locat+"/logout";
}
//强制某用户下线
function goOutUser(theuser){
	websocket.send('[goOut]'+theuser);
}




//换肤
function hf(b){
	
	var a=$(document.body);
	a.attr("class",a.hasClass("navbar-fixed")?"navbar-fixed":"");
	if(b!="default"){
		a.addClass(b);
	}if(b=="skin-1"){
		$(".ace-nav > li.grey").addClass("dark");
	}else{
		$(".ace-nav > li.grey").removeClass("dark");
	}
	if(b=="skin-2"){
			$(".ace-nav > li").addClass("no-border margin-1");
			$(".ace-nav > li:not(:last-child)").addClass("white-pink")
			.find('> a > [class*="icon-"]').addClass("pink").end()
			.eq(0).find(".badge").addClass("badge-warning");
	}else{
			$(".ace-nav > li").removeClass("no-border").removeClass("margin-1");
			$(".ace-nav > li:not(:last-child)").removeClass("white-pink")
			.find('> a > [class*="icon-"]').removeClass("pink").end()
			.eq(0).find(".badge").removeClass("badge-warning");
	}
	if(b=="skin-3"){
		$(".ace-nav > li.grey").addClass("red").find(".badge").addClass("badge-yellow");
	}else{
		$(".ace-nav > li.grey").removeClass("red").find(".badge").removeClass("badge-yellow");
	}
}

//修改个人资料
function editUserH(){
	 jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="个人资料";
	 diag.URL = locat+'/user/goEditU.do?USER_ID='+USER_ID+'&fx=head';
	 diag.Width = 225;
	 diag.Height = 389;
	 diag.CancelEvent = function(){ //关闭事件
		diag.close();
	 };
	 diag.show();
}

//系统设置
function editSys(){
	 jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="系统设置";
	 diag.URL = locat+'/head/goSystem.do';
	 diag.Width = 600;
	 diag.Height = 596;
	 diag.CancelEvent = function(){ //关闭事件
		diag.close();
	 };
	 diag.show();
}

//代码生成
function productCode(){
	 jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="代码生成器";
	 diag.URL = locat+'/head/goProductCode.do';
	 diag.Width = 800;
	 diag.Height = 450;
	 diag.CancelEvent = function(){ //关闭事件
		hangge();
		diag.close();
	 };
	 diag.show();
}

//数据字典
function zidian(){
	 jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="数据字典";
	 diag.URL = locat+'/dictionaries.do?PARENT_ID=0';
	 diag.Width = 799;
	 diag.Height = 460;
	 diag.CancelEvent = function(){ //关闭事件
		diag.close();
	 };
	 diag.show();
	 
}

//菜单
function menu(){
	 jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="菜单编辑";
	 diag.URL = '/menu/index';
	 diag.Width = 720;
	 diag.Height = 390;
	 diag.CancelEvent = function(){ //关闭事件
		diag.close();
	 };
	 diag.show();
	 
}

//切换菜单
function changeMenu(){
	websocket.send('[changeMenu]'+user);
}

//清除加载进度
function hangge(){
	$("#jzts").hide();
}

//显示加载进度
function jzts(){
	$("#jzts").show();
}
</script>
</body>
</html>
